package cn.lhf.myblog.utils;

public class StringUtils {
    public static String toHex(String str) {
        if (str == null)
            return null;
        byte[] bytes = str.getBytes();
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            sb.append(String.format("%02x", b));
        }
        return sb.toString();
    }

    public static boolean isEmpty(String str) {
        return str ==  null || str.isEmpty();
    }

    public static boolean isNotEmpty(String str) {
        return str != null && !str.isEmpty();
    }
}
